@extends('layouts.app')

@section('content')
<!-- Main content -->
<section class="content">
  <div class="row">
    <div class="col-xs-12">
      <div class="box">
        <div class="box-header">
          <a href="{{ url('/api_admin/managers') }}" class="btn btn-default">返回</a>
        </div>
        <div class="box-body table-responsive no-padding">
			    <form class="form-horizontal col-md-6 col-md-offset-3" action="{{ url('/api_admin/managers') }}" method="post">
            {!! csrf_field() !!}
            <div class="form-group {{ $errors->has('name') ? ' has-error' : '' }}">
              <label for="name" class="col-sm-2 control-label">用户名</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" id="name" placeholder="用户名" name="name" value="{{ old('name') }}">
                @if ($errors->has('name'))
                  <span class="help-block">
                    <strong>{{ $errors->first('name') }}</strong>
                  </span>
                @endif
              </div>
            </div>
            <div class="form-group {{ $errors->has('email') ? ' has-error' : '' }}">
              <label for="email" class="col-sm-2 control-label">邮箱</label>
              <div class="col-sm-10">
                <input type="text" class="form-control" id="email" placeholder="邮箱" name="email" value="{{ old('email') }}">
                @if ($errors->has('email'))
                  <span class="help-block">
                    <strong>{{ $errors->first('email') }}</strong>
                  </span>
                @endif
              </div>
            </div>
            <div class="form-group {{ $errors->has('password') ? ' has-error' : '' }}">
              <label for="password" class="col-sm-2 control-label">密码</label>
              <div class="col-sm-10">
                <input type="password" class="form-control" id="password" placeholder="密码" name="password">
                @if ($errors->has('password'))
                  <span class="help-block">
                    <strong>{{ $errors->first('password') }}</strong>
                  </span>
                @endif
              </div>
            </div>
            <div class="form-group {{ $errors->has('password_confirmation') ? ' has-error' : '' }}">
              <label for="password_confirmation" class="col-sm-2 control-label">确认密码</label>
              <div class="col-sm-10">
                <input type="password" class="form-control" id="password_confirmation" placeholder="确认密码" name="password_confirmation">
                @if ($errors->has('password_confirmation'))
                  <span class="help-block">
                    <strong>{{ $errors->first('password_confirmation') }}</strong>
                  </span>
                @endif
              </div>
            </div>
            <div class="form-group">
              @forelse($roles as $role)
                <label class="col-sm-2 control-label"></label>
                <div class="checkbox col-sm-10">
                  <label>
                    <input type="checkbox" value="{{ $role->id }}" name="roles[]">
                    {{ $role->display_name }}
                  </label>
                </div>
              @endforeach
            </div>
            <div class="form-group">
              <div class="col-sm-offset-2 col-sm-10">
                <button type="submit" class="btn btn-primary">添加</button>
              </div>
            </div>
          </form>
        </div>
      </div>
    </div>
  </div>
</section>
@endsection